// 引入uuid
import { v4 as uuidv4 } from 'uuid';

export const getUUID = () => {
	let uuid_token = localStorage.getItem('UUID_TOKEN');
	// 判断是否有数据
	// 没有数据调用方法将数据存储在本地
	// 有数据直接return => uuid_token
	if (!uuid_token) {
		uuid_token = uuidv4();
		localStorage.setItem('UUID_TOKEN', uuid_token);
	}
	return uuid_token;
};
